import request from '@/utils/request'

// 查询
export function listJob(query,page) {
  const quertParam = {
    "pageSize": page.pageSize,
    "pageNum" : page.pageNum,
    "obj" : query
  }

  return request({
    url: '/server/job/list',
    method: 'post',
    data: quertParam
  })
}


// 获取分片策略
export function getZone() {
  return request({
    url: '/server/job/zoneMethods',
    method: 'post',
    data: {}
  })
}

//开启Job
export function startJob(jobId) {
  return request({
    url: '/server/job/startMjob',
    method: 'post',
    param: {'jobId':jobId}
  })
}

//停止Job
export function stopJob(jobId) {
  return request({
    url: '/server/job/stopMjob',
    method: 'post',
    param: {'jobId':jobId}
  })
}

//获取注册节点信息
export function getNodeList(jobId) {
  debugger
  return request({
    url: '/server/job/ipPortLook',
    method: 'post',
    data: {'jobId':jobId}
  })
}

// 新增
export function addJob(query) {
  return request({
    url: '/server/job/addNewJob',
    method: 'post',
    data: query
  })
}

// 修改
export function updateJob(data) {
  return request({
    url: '/server/job/updMjob',
    method: 'post',
    data: data
  })
}





// 删除
export function delJob(roleId) {

  if(typeof roleId  === 'object'){
    roleId = roleId.toString().replace(/(\")/g, "");
  }

  return request({
    url: 'user/sysRole/delete' ,
    method: 'post',
    data:roleId
  })
}
